﻿/*------------------------------------------------------------------
-- COPYRIGHT (C) 2010-2012  Atom
-- ALL RIGHTS RESERVED.
-- 兆尹科技
-- CREATE DATE: 2010/07/12
-- CREATE MAN:liujian	
-- 不重复的字符串类
-- MODIFY HISTORY:
-- MODIFY DATE:
-- MODIFY MAN:	
-- MODIFY DESC:
-- MODIFY DATE:
-- MODIFY MAN:	
-- MODIFY DESC:
---------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Text;

namespace Atom.Common
{
    /// <summary>
    /// 不重复的字符串
    /// </summary>
    public class UniqueStringList : UniqueList<string>
    {
        /// <summary>
        /// 构造函数，比较字符串不会忽略大小写
        /// </summary>
        public UniqueStringList()
            :this(false)
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="ignoreCase">比较字符串是否需要忽略大小写</param>
        public UniqueStringList(bool ignoreCase)
            : base(Create(ignoreCase))
        {
        }

        private static Comparison<string> Create(bool ignoreCase)
        {
            return new Comparison<string>((_s1, _s2) => 
            {
                return string.Compare(_s1, _s2, ignoreCase);
            });
        }
    }
}
